package servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class LoginControl extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        1、接收参数
        String userName = request.getParameter("userName");
        String pwd = request.getParameter("pwd");
        if("zhangsan".equals(userName) && "123".equals(pwd)){
            request.getRequestDispatcher("/welcome").forward(request,response);
        }else{
            request.getRequestDispatcher("/login").forward(request,response);
        }



    }
}
